package com.googlecode.kipler.container.dl.operational;

import java.util.Comparator;

import com.googlecode.kipler.container.dl.World;

public class WorldNameComparator implements Comparator<World> {
	private World world;

	public WorldNameComparator(World world) {
		setWorld(world);
	}

	public World getWorld() {
		return world;
	}

	public void setWorld(World world) {
		this.world = world;
	}

	public int compare(World arg0, World arg1) {
		return getNo(arg0.getName()) - getNo(arg1.getName());
	}

	private int getNo(String worldName) {
		return Integer.parseInt(worldName.substring(2));
	}
}
